{include file="public/header"}
<body>
    <style>
        .layui-form-label{
            width: 200px;
        }
        .layui-input{
            width:70%;
        }
    </style>

        <form class="layui-form" action="">
            <div class="layui-form-item">
                <label class="layui-form-label"><span style="color:red">*</span> 上级代理商名称</label>
                <div class="layui-input-block">
                    <input type="text" value="和诚管控科技有限公司" placeholder="上级代理商名称" readonly class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span style="color:red">*</span> 代理商名称</label>
                <div class="layui-input-block">
                    <input type="text" name="name" required value="" lay-verify="required" placeholder="代理商名" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span style="color:red">*</span> 手机号</label>
                <div class="layui-input-block">
                    <input type="text" name="mobile" required value="" lay-verify="phone" placeholder="必须是11位手机号码" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span style="color:red">*</span> 银行卡号</label>
                <div class="layui-input-block">
                    <input type="text" name="card_number" required value="" lay-verify="required" placeholder="请输入银行卡号" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span style="color:red">*</span> 对应银行名称</label>
                <div class="layui-input-block">
                    <input type="text" name="card_bank" required value="" lay-verify="required" placeholder="请输入卡号对应的银行名称" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span style="color:red">*</span> 持卡人姓名</label>
                <div class="layui-input-block">
                    <input type="text" name="card_name" required value="" lay-verify="required" placeholder="请输入持卡人姓名" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span style="color:red">*</span> 身份证号</label>
                <div class="layui-input-block">
                    <input type="text" name="id_card" required value="" lay-verify="required" placeholder="请输入身份证号" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span style="color:red">*</span> 绑定手机</label>
                <div class="layui-input-block">
                    <input type="text" name="card_mobile" required value="" lay-verify="phone" placeholder="银行卡绑定的手机号" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span style="color:red">*</span> 等级选择</label>
                <div class="layui-input-block">
                    <select name="level">
                        <option value="" selected="selected"></option>
                        <option value="县级代理">县级代理</option>
                        <option value="市级代理">市级代理</option>
                        <option value="省级代理">省级代理</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span style="color:red">*</span> 代理商代理区域</label>
                <div class="layui-input-block">
                    <input type="text" name="address" required value="" lay-verify="required" placeholder="如：湖南省 长沙市 岳麓区" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="admin-form">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>


{include file="public/footer"}

    <script>
        layui.use('form', function(){
            var form = layui.form();
            form.on('submit(admin-form)', function(data){
                $.ajax({
                    type: "POST",
                    url: '{:url("add")}',
                    data: data.field,
                    success: function(msg){
                        if( msg.errorCode == 0 ){
                            layer.msg(msg.msg,{time:1800},function(){
                                location.reload();
                            });
                        }else{
                            parent.layer.msg(msg.msg, {
                                icon: 5,
                                shade: [0.6, '#393D49'],
                                time:1500
                            });
                        }
                    }
                });
                return false;
            });

        });
    </script>

</body>
</html>